package main

import (
	"fmt"
	"math"
)

func main() {
	fmt.Println(addBinary("0", "0"))
}

func addBinary(a string, b string) string {
	carry := 0
	length := int(math.Max(float64(len(a)), float64(len(b)))) + 1
	result := make([]int32, length)
	ida := len(a) - 1
	idb := len(b) - 1
	for i := length - 1; i > 0; i-- {
		tmp := 0
		if ida >= 0 {
			tmp += int(a[ida]) - 48
			ida--
		}
		if idb >= 0 {
			tmp += int(b[idb]) - 48
			idb--
		}
		tmp += carry
		if tmp > 1 {
			carry = 1
		} else {
			carry = 0
		}
		result[i] = int32(tmp%2) + 48
	}
	if carry == 1 {
		result[0] = 49
	}
	return string(result)
}
